package aceona.api.weibo.sina.demo;

import weibo4j.Weibo;
import weibo4j.model.PostParameter;
import weibo4j.model.WeiboException;
import weibo4j.org.json.JSONArray;
import weibo4j.org.json.JSONObject;
import weibo4j.util.WeiboConfig;

public class WeiBoTools {
	
	public static JSONObject getAsJSONObject(String apiUrl) throws WeiboException{
		return Weibo.client.get(
				WeiboConfig.getValue("baseURL") + apiUrl +".json")
				.asJSONObject();
	}
	public static JSONObject getAsJSONObject(String apiUrl,PostParameter[] params) throws WeiboException{
		return Weibo.client.get(
				WeiboConfig.getValue("baseURL") + apiUrl +".json",params)
				.asJSONObject();
	}
	
	public static JSONArray getAsJSONArray(String apiUrl) throws WeiboException{
		return Weibo.client.get(
				WeiboConfig.getValue("baseURL") + apiUrl +".json")
				.asJSONArray();
	}
}
